// This is P4 sample source for basic_switching
#include <tofino/constants.p4>
#include <tofino/intrinsic_metadata.p4>
#include <tofino/primitives.p4>
#include <tofino/pktgen_headers.p4>
#include <tofino/stateful_alu_blackbox.p4>
#include <tofino/wred_blackbox.p4>

#include "includes/headers.p4"
#include "includes/parser.p4"
#include "includes/macro.p4"
#include "includes/tofino.p4"

#define CPU_PORT 192

header_type metadata_t {
  fields {
  do_ing_mirroring : 1;
  do_egr_mirroring : 1;
  ing_mir_ses : 10;
  egr_mir_ses : 100;
  new_pkt: 1;
  }
}

metadata metadata_t md;

action add_cpu_header() {
    modify_field(ig_intr_md_for_tm.ucast_egress_port, CPU_PORT);
}

table fabric_tbl {
    actions {
      add_cpu_header;
    }
    default_action: add_cpu_header;
}


control ingress {
    apply(fabric_tbl);
}

control egress {
}
